<template>
  <div class="menu">
    <div class="menu_button">
      <slot>
        <a @click="goback"
           href="javascript:void(0)">
          <div class="img_block">
            <img class="img_margin"
                 src="/static/web/theme/gov_base_terminal/img/icon_fanhui.png"
                 alt="返回">
          </div>
          <span>返回</span>
        </a>
        <router-link to="/"
                     v-if="home">
          <div class="img_block">
            <img class="img_margin"
                 src="/static/web/theme/gov_base_terminal/img/icon_fanhuishouye.png"
                 alt="返回首页">
          </div>
          <span>返回首页</span>
        </router-link>
      </slot>
    </div>
    <span class="page_name">{{title}}</span>
    <div class="menu_button right">
    </div>
  </div>
</template>
<script>
export default {
  props: {
    title: {},
    home: {
      default: false
    }
  },
  methods: {
    goback () {
      this.$router.go(-1)
    }
  }
}
</script>
<style lang="scss">
.menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 1.6rem;
  padding: 0 0.5rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  overflow: auto;
  background: url('https://ynterminal.laway.cn/static/img/bg_header.png')
    no-repeat;
  .page_name {
    color: #fff;
    font-size: 0.44rem;
    text-align: center;
    line-height: 1.6rem;
  }
  .menu_button {
    display: flex;
    width: 2.5rem;
    a {
      display: flex; // width: 84px;
      height: 0.84rem;
      margin-right: 0.9rem;
      flex-shrink: 0;
      &:last-child {
        margin-right: 0;
      }
      .img_block {
        background: url('https://ynterminal.laway.cn/static/img/icon_menu_btn_bg.png')
          no-repeat;
        display: block;
        width: 0.84rem;
        height: 0.84rem;
        margin-right: 0.2rem;
        text-align: center;
        line-height: 0.84rem;
        background-size: cover;
        img {
          margin: 0 auto;
        }
      }
      span {
        display: inline-block;
        line-height: 0.84rem;
        font-size: 0.24rem;
        color: #fff;
      }
    }
  }
  .right {
    justify-content: flex-end;
  }
  .servicePoint {
    color: #fff;
    font-size: 0.24rem;
    display: flex;
    justify-content: center;
    align-items: center;
    span {
      margin-right: 0.1rem;
    }
  }
}

@media screen and (orientation: portrait) {
  .menu .menu_button a {
    margin-right: 0.4rem;
    span {
      display: none;
    }
  }
}
</style>
